#!/bin/sh
if [ $# -eq 1 ];then
   if grep --binary-files=text $1 /etc/passwd > /dev/null
   then
      echo "This user is exist !!!"
   else
      useradd -d /home/cvsusers/$1 -s /usr/bin/passwd $1 -g cvs
      echo $1 | passwd  --stdin $1
      echo user $1 has added.
   fi
else
   for i in $*
   do
      echo $i
      if grep --binary-files=text $i /etc/passwd > /dev/null
      then
         echo "This user $i is exist !!!"
      else
         useradd -d /home/cvsusers/$i -s /usr/bin/passwd $i -g cvs
         echo $i | passwd  --stdin $i
         echo user $i has added.
      fi
   done
fi


#for i in $(cat userlist.txt)
#do
   #useradd -d /home/cvsusers/$1 -s /usr/bin/passwd $1 -g cvs
   #echo $1 | passwd  --stdin $1
   #echo user $1 has added.
#fi
#done